package com.ynet.exception;

import java.io.IOException;
import java.util.Properties;

import org.springframework.core.io.ClassPathResource;
import org.springframework.stereotype.Component;

@Component
public class MessageStaticUtils {
	
	private static Properties properties;
	
	private MessageStaticUtils(){
		properties = new Properties();
		try {
			properties.load(new ClassPathResource("errors.properties").getInputStream());
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	
	public static String getMessage(String code) {
		
		if(properties == null){
			new MessageStaticUtils();
		}
		
		String value = (String) properties.get(code);
		
		return value;
		
	}


}
